package com.jlf.tool.validation;


import com.jlf.tool.validation.constraint.NotBlankConstraintValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 有条件的非空校验
 *
 * @author wujr
 * 2022/6/29
 * @version 1.0
 * 【变更历史】
 * [wujr 2022/6/29 1.0 新增]
 */
@Documented
@Constraint(validatedBy = {NotBlankConstraintValidator.class})
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface NotBlankOnConditional {
    /**
     * 符合的条件
     * el表达式，例如：#type = 2
     * @return 联合条件表达式
     */
    String when();
    String message() default "{javax.validation.constraints.NotBlankOnConditional.message}";
    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
